package com.gitee.nacos.discovery;

import com.gitee.nacos.config.MyNacosDiscoveryProperties;
import com.gitee.nacos.myregistrar.MyNacosAutoServiceRegistration;
import com.gitee.nacos.myregistrar.MyNacosServiceRegistry;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@EnableConfigurationProperties(MyNacosDiscoveryProperties.class)
public class MyNacosDiscoveryAutoConfiguration {

    @Bean
    public MyNacosServiceRegistry nacosServiceRegistry(
            MyNacosDiscoveryProperties nacosDiscoveryProperties) {
        return new MyNacosServiceRegistry(nacosDiscoveryProperties);
    }

    @Bean
    public MyNacosAutoServiceRegistration nacosAutoServiceRegistration(
            MyNacosServiceRegistry nacosServiceRegistry) {
        return new MyNacosAutoServiceRegistration(nacosServiceRegistry);
    }
}
